#include <gui/batterypage_screen/BatteryPageView.hpp>
#include <texts\TextKeysAndLanguages.hpp>
#include <images/BitmapDatabase.hpp>
//
BatteryPageView::BatteryPageView()
{

}

void BatteryPageView::setupScreen()
{
    BatteryPageViewBase::setupScreen();
}

void BatteryPageView::tearDownScreen()
{
    BatteryPageViewBase::tearDownScreen();
}
//页面跳转
void BatteryPageView::BatteryPageChange(uint8_t newFiveKeyFunc)
{
		handleKeyEvent(newFiveKeyFunc);
}
//更新电压、电流
void BatteryPageView::updateBatteryPageInfo(uint16_t CurrentVal, uint16_t VoltageVal)
{
		uint16_t pCurrent = (CurrentVal)*330/4095;
		//更新电流
		Unicode::snprintf(textAreaIBuffer, TEXTAREAI_SIZE, "%3d",pCurrent);	//单位mA
	  textAreaI.invalidate();
		//更新电压
		Unicode::snprintfFloat(textAreaVBuffer, TEXTAREAV_SIZE, "%.3f",(VoltageVal)*3.3f/4095);	//单位V
	  textAreaV.invalidate();
		//更新电池图标
		imageProgressVol.setValue(VoltageVal);
		//更新电流图标
		dynamicGraphCur.addDataPoint(pCurrent);
}